package com.asiainfo.dacp.datastash.orm.dao.core;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.asiainfo.dacp.datastash.orm.po.core.DataStashBrokerPo;

@Repository
public interface DataStashBrokerDao extends JpaRepository<DataStashBrokerPo, String>,JpaSpecificationExecutor<DataStashBrokerPo>{
	
	@Query("select p from DataStashBrokerPo p where p.brokerIp=:brokerIp or p.isAlive=:isAlive")
	public List<DataStashBrokerPo> findByBrokerIp(@Param("brokerIp") String brokerIp,@Param("isAlive") String isAlive);
	
	@Query("select p from DataStashBrokerPo p where p.brokerIp=:brokerIp and p.isAlive=:isAlive")
	public List<DataStashBrokerPo> findByBrokerIpAndState(@Param("brokerIp") String brokerIp,@Param("isAlive") String isAlive);
}
